package com.diana.springcloud.cloudprovicer.controller;

import com.diana.springcloud.cloudprovicer.entity.UserEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Suna
 * @Date 2020/8/24 15:39
 */
@RestController
public class UserController {

    @GetMapping("/getUser/{userId}")
    public UserEntity getUser(@PathVariable int userId){
        UserEntity userEntity = new UserEntity();
        if(userId == 1){
            userEntity.setUserId(1);
            userEntity.setAge(18);
            userEntity.setName("张三");
        }else {
            userEntity.setUserId(2);
            userEntity.setAge(20);
            userEntity.setName("李四");
        }
        return userEntity;
    }
}
